<?php
session_start();
include 'fungsi.php';


if($_POST['btnaction']=="Edit")
{
   $id = $_POST['id'];
   $page = "editdata.php?id=".$id;
   $hasil = new fungsi();
   $masuk = $hasil->redirectPage($page);
   echo $masuk;
}

$log = $_GET['log'];
//if($log=='in'){
	$user = $_SESSION['username'];
	
	if(!isset($user)){ //|| $log!="in"){
		die("Anda belum Login, silahkan kembali ke halaman awal anda");
		
		/*$page = "home-guess.php";
		$keluar = $hasil->redirectPage($page);
		echo $keluar;*/
		
	}

	if($_SESSION['hak_akses']!="1"){
		die("!!");
	}
//}

?>
<html lang="en">
<head>
	<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>
</head>
<header>  
<title>Jajanan Ngalam</title>
	<div class="hero-unit" style="margin-left:70px; margin-top:70px; margin-right:80px">
		<h1><font face="comic sans MS" color="green">JAJANAN NGALAM</font></h1>
		<p><font face="comic sans MS" size=4> Website Integrasi pedagang jajanan asli kota Malang </font></p>
	</div>
</header>
<body style= "background-image:url(images/blue.jpg)">
<div class="hero-unit" style="width:80%; height:auto; margin-left:70px;">
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="row">
				<div class="span9">	
					<div class="navbar">
						<div class="navbar-inner" style="margin-left:20; margin-right:20">
						<a class="brand">ADMIN</a>
							<ul class="nav">
								<li class="active"><a href="home_adm.php">Home</a></li>
								<li><a href="Daftar_akun.php">Akun Pengguna</a></li>
								<li><a href="Daftar_produk.php">Produk Kami</a></li>
								<li><a href="#">Info Malang</a></li>
								<li><a href="#">Lokasi Kuliner</a></li>
								<li><a href="#">Kritik dan Saran</a></li>
							</ul>
						</div>
						<div class="container-fluid">
							<div class="well span12">
									<a>
										<?php
										$hasil = new fungsi();
										$hasil->konek();
										$liat=$hasil->info();
										while($rows = mysql_fetch_array($liat)){
											$id=$rows['id_info'];
											$judul=$rows['judul_artikel'];
											$deskripsi=$rows['deskripsi'];
											$tanggal=$rows['tanggal'];
											
											echo '<table class="table table-bordered">
													<tr>
														<td>
															<font size=5 align="right" name="judul">'.$judul.'</font>
															<p  class="span10" style="color:black" align="justify" name="deskripsi" ><font size=2>'.$deskripsi.'</font></p>
															<p align="right" name="tanggal"><font size=2>'.$tanggal.'</font></p>
														</td>
													</tr>
												</table>';
										
											echo "<form method='POST' action=''>";
											echo "<input type='hidden' name='id' value='".$id."'>";
											echo "<input type='submit' name='btnaction' style='width:70' value='Edit'>";
											//echo "<input type='submit' name='btnaction' onclick=\"return konfirmasiHapus('".$id."');\" value='Hapus'>";
													//<button class="btn" name="btnaction" style="width:70" value='.$id.'>Edit</button>
													//<button class="btn" name="btnaction" style="width:70">Hapus</button>
											echo	"</form>";
												
										}
										
										?>
									</a>
								
									
							
									
							</div>
							
						</div>	
					</div>	
				</div>	
				<div class="span3">
				<?php 
				session_start();
				?>
					<form class="well" method="POST" action="logout.php">
						<h4>Selamat datang di halaman administrator <?php $cek=$_SESSION['username']; echo $cek; ?> !</h4>
						<button type="submit" class="btn">Keluar</button>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
	<script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="js/bootstrap.min.js"></script>
</body>
<footer>
	<div class="hero-unit" style="margin-left:70px; margin-bottom:70px; margin-right:80px">
	</div>
</footer>
</html>
